<?php 
/**
 * Show Shift Status function
 *
 * Provides Employee Shift Information
 *
 * @author Manas Kalucha <manaskalucha@gmail.com>
 */

include_once 'UTerrorcode.php';
include_once 'UTcheckAuth.php';
include_once 'UTDBGlobal.php';

function shiftDesc($userName,$userPassHash)
{
	global $dbaddress;
    global $dbuser;
    global $dbpassword;
    global $dbdatabasename;
	
	$output = array();
	$auth = 0;
	if (checkAuthentication($userName, $userPassHash) == true) {
	
		$r = array();
		$conn = mysqli_connect($dbaddress,$dbuser,$dbpassword,$dbdatabasename);
		$sql = "SELECT * FROM roledate";
		$result = mysqli_query($conn, $sql);
		$row = mysqli_fetch_row($result);
		
		if($result->num_rows>0){
	
			while($row = $result->fetch_assoc()){
				$r[count($r)]= array('shiftStatusCode' => $row['roleID'] , 'shiftStatusDescription'=>$row['shiftStatus']);
			}
			$error = ErrorCode::successRead;
			$output = array('code' => $error, 'value' => $r);
		}
	} else {
		$error = ErrorCode::authFailRead;
		$output = array('code' => $error);
	}
	return $output;
}



?>
